/*
             LUFA Library
     Copyright (C) Dean Camera, 2009.
              
  dean [at] fourwalledcubicle [dot] com
      www.fourwalledcubicle.com
*/


#ifndef _USBTOINTERFACE_H_
#define _USBTOINTERFACE_H_

	/* Includes: */
		#include <avr/io.h>
		#include <avr/wdt.h>
		#include <avr/interrupt.h>
		#include <avr/power.h>

		#include <LUFA/Version.h>

		#include <LUFA/Drivers/USB/USB.h>

		   #include "usbtointDescriptors.h"



	/* Macros: */

   #define LED2_off()   PORTE  |=  (1 << PE6)
   #define LED1_off()   PORTF  |=  (1 << PF0)
   #define LED3_off()   PORTF  |=  (1 << PF1)

   #define LED2_on()  PORTE  &=  ~(1 << PE6)
   #define LED1_on()  PORTF  &=  ~(1 << PF0)
   #define LED3_on()  PORTF  &=  ~(1 << PF1) 


   #define SET_portef() LED1_off();  \
                        LED2_off();  \
                        LED3_off() 
 
   #define INIT_leds() SET_portef();       \
                       DDRF  |= (1 << DDF0) | (1 << DDF1); \
                       DDRE  |= (1 << DDE6)

   #define LED1_t()   PORTF  ^=  (1 << PF0)
   #define LED3_t()   PORTF  ^=  (1 << PF1) 
   

	/* Global Variables: */
		extern volatile uint8_t dataToSend[];
		extern volatile uint8_t dataReceived[];

	/* Function Prototypes: */
		void SetupHardware(void);
		void Kernschmiede_Task(void);
	
		void EVENT_USB_Device_Connect(void);
		//void EVENT_USB_Device_Disconnect(void);
		void EVENT_USB_Device_ConfigurationChanged(void);
		void EVENT_USB_Device_UnhandledControlRequest(void);

		void ReceiveDataFromHost(void);
		//void SendDataToHost(void);

#endif














